package com.atnjupt.java;
/**
 * @author Wizarder
 * @create 2021-05-27 14:17
 */

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Response1", value = "/Response1")
public class Response1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("曾到此一游Response1");
        // 设置响应状态码302 ，表示重定向，（已搬迁）
//        request.setAttribute("key1","value1");//域数据不共享
//        response.setStatus(302);
//        // 设置响应头，说明 新的地址在哪里
//        response.setHeader("Location","http://localhost:8080/07_servlet/response2");
        response.sendRedirect("http://www.baidu.com");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
